package com.youngball.service;

import com.youngball.thread.ExecutorProvide;
import com.youngball.thread.TcpRunTheadService;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * Created by liaopingzhu on 2016/9/30.
 */
@Component
public class SocketRunInitService implements ApplicationListener {
    public static int i=0;

    public void onApplicationEvent(ApplicationEvent applicationEvent) {
        if(i == 0){
            System.out.println(i);
            ExecutorProvide.get().execute(new TcpRunTheadService());
            i = 1;
        }
    }
}
